<html>
<head>
    <meta charset="UTF-8">
    <title>新增燃气价格</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="../../layui/css/layui.css"/>
    <link rel="stylesheet" href="../../css/bass.css"/>
    <style>
        .layui-form{
            width:35%;
        }
        .layui-input{
            width: 100% !important;
        }
    </style>
</head>

<body>
<div class="body">
    <header class="layui-nav" id="headerTop"></header>
    <div class="left_muen" id="left_menu"></div>
    <div class="content_body">

        <!--标题栏-->
        <p class="content_title">气量管理 &nbsp;&nbsp;>&nbsp;&nbsp;当日燃气价格&nbsp;&nbsp;>&nbsp;&nbsp;新增价格</p>
        <!--标题栏-->

        <form class="layui-form mt20">
            <div class="layui-form-item">
                <label class="layui-form-label">价格</label>

                <div class="layui-input-block">
                    <input type="text" name="price" lay-verify="required|number" autocomplete="off" placeholder="价格"
                           class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">单位</label>

                <div class="layui-input-block">
                    <input type="text" name="unit" lay-verify="required" placeholder="请输入单位" autocomplete="off"
                           class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <!--<div class="layui-inline" style="width: 37%">-->
                    <label class="layui-form-label">日期</label>
                    <div class="layui-input-block">
                        <input type="text" name="date" id="date1" lay-verify="date"  lay-verify="required"  placeholder="请选择日期"
                               autocomplete="off" class="layui-input">
                    </div>
                <!--</div>-->
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <div class="layui-btn" lay-submit="" lay-filter="submitFilter">立即提交</div>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="../../js/common/jquery-1.11.3.min.js"></script>
<script src="../../layui/layui.js"></script>
<script src="../../js/common/navList.js"></script>
<script src="../../js/common/ajax.js"></script>
<script>
    layui.use(['form', 'laydate','layer'], function () {
        var form = layui.form, layer = layui.layer, laydate = layui.laydate;
        laydate.render({
            elem: '#date1'
        });
        //监听提交
        form.on('submit(submitFilter)', function (data) {
            console.log(data.field)
            ajaxPost({
                url: 'daygasprice/add',
                data: {
                    unit: data.field.unit,
                    date: data.field.date,
                    price: data.field.price
                },
                successFull: function (res) {
                    console.log(res)
                    layer.msg('添加成功', {
                        icon: 6
                    });
                    window.location.href = "./arrPay.html?pos=4&childPos=0";
                },
                errCallBack: function (res) {
                    layer.msg(res.msg, {
                        icon: 6
                    });
                }
            })
        });
    });
</script>
</body>
</html>